#ifndef _TLOGGER_H_
#define _TLOGGER_H_
#include <mutex>
#define log_debug(...)	g_log.WriteLog("DEBUG", __VA_ARGS__)
#define log_info(...)	g_log.WriteLog("INFO", __VA_ARGS__)
#define log_warn(...)	g_log.WriteLog("WARN", __VA_ARGS__)
#define log_error(...)	g_log.WriteLog("ERROR", __VA_ARGS__)
#include "TNoCopyable.h"
class Logger : TNoCopyable
{
public:
    Logger(char* filePath);
    ~Logger();
public:
    void WriteLog(const char* level, const char* fmt, ... );
private:
    char	filePath_[256];
    FILE*	logFile_;
    char	writeBuf_[10*1024];
    int		logFileTime_;
    std::mutex mutex_;
private:
    void OpenFile(char* command);
};

extern Logger g_log;

#endif

